package client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class RegisterClient {
	
private final static Logger logger = LogManager.getLogger(ChatClient.class);
	
	private Socket socket;
	private BufferedReader reader;
	private BufferedWriter writer;
	
	public RegisterClient() {
			try {
				socket = new Socket("127.0.0.1",8004);
				writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
				reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			} catch (IOException e) {
				logger.error(e);
			}
	}
	
	public void close(){
		try {
			reader.close();
			writer.close();
			socket.close();
		} catch (IOException e) {
			logger.error(e);
		}
		
	}

	public BufferedReader getReader() {
		return reader;
	}

	public BufferedWriter getWriter() {
		return writer;
	}
}
